<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网页加载</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
        }
        header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 50px;
            background-color: #333;
            color: white;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 15px;
            z-index: 10;
        }
        header h1 {
            margin: 0;
            font-size: 18px;
        }
        header .back-button {
            background: none;
            border: none;
            color: white;
            font-size: 16px;
            cursor: pointer;
        }
        iframe {
            width: 100%;
            height: calc(100vh - 50px); /* 减去顶栏的高度 */
            border: none;
            margin-top: 50px; /* 顶栏的高度 */
        }
    </style>
</head>
<body>
    <header>
        <button class="back-button" onclick="location.href='index.php'">返回</button>
        <h1>加载的网页</h1>
    </header>

    <?php
    // 检查是否通过 GET 参数传递了内容
    $content = isset($_GET['link']) ? $_GET['link'] : null;

    if ($content) {
        // 对传递的内容进行解码
        $decodedContent = urldecode($content);
        // 使用 iframe 加载内容
        echo "<iframe src=\"{$decodedContent}\" title=\"加载的内容\"></iframe>";
    } else {
        // 未传递内容时的提示
        echo "<p style='padding: 60px; text-align: center;'>未提供任何内容。</p>";
    }
    ?>
</body>
</html>